import Vue from 'vue'

/**权限指令**/
const has = Vue.directive('has', {
    bind: function (el, binding) {
        if (!Vue.prototype.$_has(binding.value)) {
            // el.parentNode.removeChild(el);
            el.style.display = 'none';
        }
    }
});
//权限检查方法
Vue.prototype.$_has = function (value) {
    let isExist = false;
    //从权限获取
    let buttonperms = ['ceshi'];
    // 权限列表
    for (let i = 0; i < buttonperms.length; i++) {
        if (buttonperms[i].indexOf(value) > -1) {
            isExist = true;
            break;
        }
    }
    return isExist;
};

export {has}
